Memory-based history search

ABSTRACT

Systems, devices and methods for data compression using history search for dictionary based compression. Systems, devices and methods may use parallel processing techniques for data compression and encoding. Systems, devices and methods may provide memory search techniques for hardware.

CROSS REFERENCE TO RELATED APPLICATION

This application claims the benefit of and priority to U.S. ProvisionalPatent Application No. 62/066,572 entitled Systems, Devices and Methodsfor Data Compression filed Oct. 21, 2014, the entire contents of whichis hereby incorporated by reference.

FIELD

Embodiments described herein relate generally to systems, devices andmethods for data compression, and in particular, to systems, devices andmethods for lossless data compression.

BACKGROUND

Data compression involves processing a sequence of symbols as input, andattempting to produce a shorter sequence as output. Lossless datacompression attempts to reduce output without losing information byidentifying and eliminating statistical redundancy within the inputdata.

DESCRIPTION OF THE FIGURES

FIG. 1 is a schematic view of an example of a system for datacompression according to some embodiments;

FIG. 2 is a schematic view of illustrative example input for compressionprocessing;

FIG. 3 is an alternate schematic view of illustrative example input forcompression processing;

FIG. 4 is a flowchart view of an example method for data compressionaccording to some embodiments;

FIG. 5 is a schematic view of a comparator network for use with datacompression according to some embodiments;

FIG. 6 is a schematic view of a timing diagram for use with datacompression according to some embodiments;

FIG. 7 is an alternate flowchart view of an example method for datacompression according to some embodiments;

FIG. 8 is alternate schematic view of an example of a system for datacompression according to some embodiments; and

FIG. 9 is an alternate schematic view of illustrative example input forcompression processing.

FIGS. 10 and 11 are tables illustrating the encoding process accordingto some embodiments.

These drawings depict exemplary embodiments for illustrative purposes,and variations, alternative configurations, alternative components andmodifications may be made to these exemplary embodiments.

SUMMARY

In an aspect, there is provided a circuit for history matching a datastream being sequentially introduced to the circuit. The circuitinvolves a first memory including N storage locations, the first memoryconfigured to store a currently introduced sequence of symbols such thatthe N most recently introduced words are stored in the first memory andan array of M second memories, each second memory including N storagelocations, the array defining a set of storage locations logicallydivided into N rows of M storage locations, each row including onestorage location from each of the M second memories, the array of Msecond memories configured to store the currently introduced word at aselect storage location of the set of storage locations. The circuit hasa plurality of comparators configured for comparing data from all of thestorage locations in the first memory with data stored in a select rowof the set of storage locations, where outputs of the comparatorsprovide history matching data and a memory selector for identifying theselect storage location, the memory selector configured to identify anext storage location in a storage location sequence with theintroduction of each word, where the storage location sequence cyclesthrough the set of storage locations such that M consecutivelyintroduced words are each stored in a different second memory in thearray. The circuit has a row selector for identifying the select row,the row selector configured to identify a next select row with theintroduction of each word, the select row cycling through each of the Nrows for every N introduced words.

In some embodiments, the plurality of comparators are configured tocompare overlapping data windows of the data in the first memory and thedata in the select row.

In some embodiments, each of the second memories are dual port memoriesor two port memories.

In some embodiments, the circuit is implemented on a field-programmablegate array (FPGA) or an application specific integrated circuit (ASIC).

In some embodiments, the second memories are block random accessmemories.

In some embodiments, the circuit has a storage device for storing theoutputs of the comparators.

In some embodiments, the first memory is a shift register or a circularbuffer.

In some embodiments, the circuit is a synchronous circuit configured tointroduce a new word every clock cycle.

In some embodiments, an introduced word is compared against an N×M wordhistory after N clock cycles.

In some embodiments, the data windows are based on an input bus width orcircuit resource availability.

In another aspect, there is provided a method for history matching adata stream. The method involves sequentially introducing each word inthe data stream. Introducing a current word in the input sequence mayincludes storing the current word in a storage location of a firstmemory having N storage locations such that the N most recentlyintroduced words are stored in the first memory, storing the currentword in an array of M second memories, each second memory including Nword storage locations, the array defining a set of storage locationslogically divided into N rows of M storage locations, each row includingone storage location from each of the M second memories, wherein thecurrent word is stored according to a storage location sequence whichcycles through the set of storage locations such that M consecutivelyintroduced words are each stored in a different second memory in thearray, and concurrently comparing data stored in the N storage locationsof the first memory with data stored in a select row of the set ofstorage locations. The method may involve storing outputs of thecomparisons as history match results, where the select row changes withthe introduction of each word, the select row cycling through each ofthe N rows for every N introduced words.

In some embodiments, comparing the data stored in the N storagelocations of the first memory with the data stored in the select rowcomprises comparing overlapping data windows of the data in the Nstorage locations of the first memory and the data stored in the selectrow.

In some embodiments, each of the second memories are dual port memoriesor two port memories.

In some embodiments, the method is performed on a field-programmablegate array (FPGA) or an application specific integrated circuit (ASIC).

In some embodiments, the second memories are block random accessmemories.

In some embodiments, storing the outputs of the comparisons comprisescollating the history match results.

In some embodiments, providing the history match results to an encoder.

In some embodiments, an introduced word is compared against an N×M wordhistory after N clock cycles. In some embodiments, the data windows arebased on an input bus width or circuit resource availability.

In another aspect, there is provided a device for history matching adata stream, each word of the data stream being sequentially introduced.The device has a first memory including N storage locations, the firstmemory configured to store a currently introduced word such that the Nmost recently introduced words are stored in the first memory, and anarray of M second memories, each second memory including N storagelocations, the array defining a set of storage locations logicallydivided into N rows of M storage locations, each row including onestorage location from each of the M second memories, the array of Msecond memories configured to store the currently introduced word at aselect storage location of the set of storage locations. The device hasa plurality of comparators configured for comparing data from all of thestorage locations in the first memory with data stored in a select rowof the set of storage locations, where outputs of the comparatorsprovide history matching data. The device also has a memory selector foridentifying the select storage location, the memory selector configuredto identify a next storage location in a storage location sequence withthe introduction of each word, where the storage location sequencecycles through the set of storage locations such that M consecutivelyintroduced words are each stored in a different second memory in thearray. The device has a row selector for identifying the select row, therow selector configured to identify a next select row with theintroduction of each word, the select row cycling through each of the Nrows for every N introduced words.

DETAILED DESCRIPTION

Data compression involves receiving a sequence of symbols as input, andattempting to produce a shorter sequence as output. Lossless datacompression attempts to reduce output without losing information byidentifying and eliminating statistical redundancy within the inputdata. Lossless data compression produces the original input stream upondecompression. Lossy compression produces a similar but possiblynon-identical stream.

Dictionary based compression systems may be configured to find repeatedsubstrings in the input and encode subsequent occurrences of thosesubstrings as pointers to earlier occurrences.

At each location in the input stream, a compression system may beconfigured to consider various factors, such as for example, anothersequence of characters, the longest sequence that has occurredpreviously, the most recent occurrence, and so on. Different factors maydetermine how well a compression system, device, or method functions.Compression systems may be evaluated using various metrics, including,for example, compression ratio, compression/decompression speed,splittability, required memory and other resources duringcompression/decompression, the ability to perform work in parallel andso on. Compression speed may be proportional to compression ratio. Someexample systems may have a high compression speed and a low compressionratio, while other systems may have a relatively low compression speedand a relatively high compression ratio, for example.

Compression speed may be an important consideration. A fast compressionsystem operating at full stream throughput may generate a relativelysmall compression ratio. This may nevertheless help reduce data output.For example, a compression device may be situated between a host deviceand a network interface controller device, or storage controller device.

In accordance with another aspect, there is provided a compressiondevice that implements a parallel history search using sortingtechniques. The parallel processing may enhance compression speed.

In accordance with another aspect, there is provided a compressiondevice having a receiver to receive uncompressed input data. The inputdata may be represented as a sequence of symbols. The compression devicemay include a processor configured to implement dictionary based historysearch on the sequence of symbols of the input data to generate anintermediate data structure of tags or tokens for encoding into acompressed output stream. The compression device may further include anencoder configured to encode the sequence of symbols of the input datafor the compressed output stream. An output generator may generatetokens as compressed output data using the encoded sequence of symbolsof the input data. The compression device may include a transmitterconfigured to transmit the compressed output data, or a storage deviceconfigured to store the compressed output data.

In accordance with another aspect, there is provided a method for datacompression. The method may involve processing input data represented asa sequence of symbols to generate output data. At each location, themethod may create a tag with a string of one or more symbols and alocation. The method may further involve sorting the tags by prefix togenerate a sorted sequence of tags. For each tag in the sorted sequenceof tags, the method may further involve comparing the tag withneighbouring or adjacent tags. If there is a tag with a common prefix ata defined number of symbols that has an earlier or other source then thecompression device creates a copy token, otherwise the compressiondevice creates a literal token. The method may involve ordering thetokens by the corresponding location or by prefix.

In accordance with an aspect, there is provided a compression devicewith parallel processing to implement a history search using sorting.The device may be implemented using a graphics processing unit (GPU) ora highly parallel central processing unit (CPU), for example.

In accordance with another aspect, there is provided a compressiondevice having an encoder to encode in parallel to generate compressedoutput data. The encoder may operate on various types of input dataresulting from a history search, for example, to encode the compressedoutput data.

In accordance with another aspect, there is provided a compressiondevice with registers, a field programmable gate array (FPGA) configuredto process uncompressed input data using search history, and blockrandom access memory for storing results of the search history.Embodiments described herein may provide a process for implementingparallel history search on FPGAs.

In accordance with another aspect, there is provided a compressiondevice having a processor configured to implement history search fordictionary-based compression, and a systolic dictionary-basedcompression encoder.

In accordance with another aspect, there is provided a method forencoding for dictionary based compression with parallel processors. Themethod may involve receiving uncompressed input data. The method mayinvolve processing input data using a backward pass. The method mayinvolve processing the input data using a cleanup pass. The method mayinvolve processing input data using a forward pass. The method mayinvolve processing input data using a leader pass. The method mayinvolve processing input data using a placement pass. The method mayinvolve generating compressed input data using results of the backwardpass, cleanup pass, forward pass, leader pass, and placement pass.

Illustrative examples are provided to show various aspects of theembodiments described herein.

FIG. 1 illustrates a schematic view of an example compression system100. Embodiments described herein may provide hardware compressiondevices 102 for transparent in-path compression and decompression, whichmay also be referred to herein as compression engine devices. As anillustrative example implementation, a compression device 102 may coupleto network interface controller device 104 for data transmission over anetwork 106. As another illustrative example implementation, acompression device 102 may couple to a storage controller device 108 fordata storage on a storage medium, e.g. flash device 112 or DRAM memorycard 110. The result of methods described herein may be a tangible,physical medium of the compressed output data.

History Search

In accordance with an aspect, embodiments described herein may providedictionary-based compression, such as a vector based history search fordictionary-based compression.

To maximize compression, an example compression system may be configuredto detect and determine the longest matching sequence. One examplesystem may be implemented by central processing units (CPU) usingpersistent data structures called trees. These data structures may bedefined as binary search trees that record the location of every prefixobserved.

Alternatively, another example compression system may keep track of themost recent occurrence of a string of symbols that matches for differentnumbers of characters, as stored in tag data structures. As anillustrative example, the number characters stored in the tag may rangefrom four to seven. If there are too few characters in the tag then theprocessed string may not be that compressed given the memory usage ofthe tags and encoding. If there are too many characters in each tag thenthe sorting may increase and, as a result, the tag size may increasememory use.

As an illustrative example, four characters per tag may be the shortesttag that does not cause expansion. Encoding a tag that copies fourcharacters may be guaranteed not to take up more space than resendingthose four characters as literals. Different encoding schemes may havedifferent cut-off points for the number of tags and this is an exampleonly. Longer tags may introduce considerable complexity when comparingneighbouring or adjacent tags post-sort. Longer tags may also increasethe compression ratio because they can distinguish between a copy thatwill be five symbols or characters long from one that is only foursymbols. Accordingly, there may be trade-off between compressioncomplexity and compression ratio.

The system may provide a lower compression ratio (e.g. uncompressed sizecompared to compressed size) as it may not find an optimal match for thecopy references but may provide faster compression speed or throughput.An example system may utilize a hash table that is updated at eachlocation in turn. Systems may be sequential and data dependent, and mayhave software configurations.

Embodiments described herein may operate using parallel processinghardware to expose benefits of parallelism. Embodiments describe hereinmay use a modified history search to identify the most recent searchthat employs data parallelism using sorting. Accordingly, the examplesystem 100 may be implemented using parallel processing hardware.

In accordance with an aspect, embodiments described herein may providedictionary-based compression, such as a vector based history search fordictionary-based compression. The hardware compression device mayconfigure various compression implementations designed for throughputover compression. The history search may be the bottleneck indictionary-based compression and techniques may create strong lineardependence chains that may be difficult or impossible to extractparallelism for.

Accordingly, embodiments described herein may involve history searchimplemented via sorting. The sorting may be implemented usingdata-parallel processing, which may be parallelized using a large numberof threads.

FIG. 2 illustrates example input for compression processing. Exampleinput may be a sequence of input symbols of uniform size, typically 8bit bytes. Example output may be a sequence of tokens of the same lengthas the input. A token may be either a literal (e.g. characters orsymbols), or a copy instruction. A copy instruction may include thelocation within the sequence the copy of the characters or symbols comesfrom, and the number of symbols being copied. The example shown in FIG.2 illustrates a copy reference pointer for symbols 9 to 13 to theearlier instance of the sequence of symbols 0 to 4. This may be referredto as backward copies.

FIG. 3 illustrates an alternative implementation with a copy referencepointer to a later instance of the sequence at symbols, which may bereferred to as forward copies.

The compression device 102 (FIG. 1) may have circuit for historysearching an input data stream to generate a history search outputstream. The circuit may have an input unit to receive an incoming inputdata stream of a sequence of symbols. A memory device stores thesequence of symbols of the input data stream at storage locations. Thismay be referred to as a history buffer. The storage locations may belinked to positions with the sequence of symbols.

The circuit has a parallel processor to implement a dictionary basedhistory search on the input data stream in the memory device using aparallel sort to generate the history search output data stream oftokens. Each token defines a type, the type being a literal token or acopy token. Each literal token defining a literal symbol of the sequenceof symbols of the input data stream. Each copy token having a copyreference pointer identifying a position of one or more copied symbolsin the sequence of symbols of the input data stream. The positioncorresponds to a storage location of the storage locations of the memorydevice storing the input data stream. The copied symbols may havecorresponding one or more literal symbols of the literal tokens of thehistory search output data stream. That is, the copy tokens may refer toa position or offset in the input data stream to refer to a copy of theliteral symbols at that position or offset. The copy token may alsoindicate how many symbols to copy. Accordingly, a copy token may definea length of symbols and an offset value for the copy reference pointer.

A comparator compares the sequence of symbols from the storage locationsin the memory to identify the one or more copied symbols and thecorresponding one or more literal symbols for the parallel sort. Amemory selector to select, for each copy reference pointer, the storagelocation corresponding to the position identified by the respective copyreference pointer. Example comparators and selectors are describedherein. An output unit connects to a recipient device to output thehistory search output stream for compression of the input data stream.

The parallel processor continuously generates tags representing theinput data stream, each tag defining a window of k consecutive symbolsin the sequence of symbols, k being an integer, and a tag position inthe sequence of symbols of the input data stream. The tag positionrefers to a first symbol of the k consecutive symbols in the window. Thetag position for a corresponding storage location of a first symbol ofthe window of k symbols in the memory device.

The parallel processor, for the parallel sort, sorts the tags based onthe windows of k symbols. The sort may be based on a lexicographic oralphanumeric order of the windows of k symbols of the tags, depending onthe type of symbols of the input data stream.

A first tag and second tag may have two consecutive tag positions, and aportion of the k symbols of the window of the first tag overlaps anotherportion of the k symbols of the window of the second tag with k−1overlapping symbols.

The comparator may compare each tag to a predetermined number ofneighbouring or adjacent tags to identify redundant tags, for eachredundant tag, the window of k symbols being equal to the window of ksymbols of another tag. In some examples k ranges between four to sevento provide an efficient compression.

A redundant tag may refer to previous occurrences of the same symbols inthe input data stream. Given Tags A and B, Tag A may be redundant to TagB if: the first j symbols of both tags are identical; 4<=j<=k, or theposition of tag A is >the position of tag B. This is an example forback-references. This may result in the circuit creating a Copy(delta=B.position−A.position, length=j) token. If A is not redundant toB, then the circuit may create a Lit (content=first symbol, length=1)token.

For each redundant tag, the parallel processor, generates a copy tokenof the copy tokens for the history search output data stream, and thememory selector selects the storage location corresponding to the tagposition of the other tag for the copy reference pointer for the copytoken for the redundant tag.

The parallel processor orders the tags, including the redundant tags, bythe tag positions to generate the output data stream of the literaltokens and the copy tokens, the copy tokens corresponding to theredundant tags at the tag positions in output data stream.

The circuit may be implemented on graphic processing unit or a parallelcentral processing unit. The circuit may couple to an encoder and anoutput generator. The encoder may transform the history search outputdata stream into a compressed output stream by coalescing a portion ofthe copy tokens and a portion of the literal tokens of the historysearch output data stream, the compressed output data stream beingcompressed relative to the input data stream. The output generator maybe configured to output the compressed output data stream. The encodercoalesces the portion of the copy tokens by the encoder coalescingconsecutive overlapping copy tokens into longer copy tokens. The encodercoalesces the portion of the literal tokens by combining individualliteral tokens into combined literal tokens of larger size. The encodercoalesces the portion of the copy tokens by, for each copy token,determining a length n of the copied literal symbols, n being aninteger, and removing n−1 subsequent literal tokens as defined by thesequence of symbols of the input data stream. In some examples, theencoder is a systolic dictionary-based compression encoder with parallelscan for a backward pass, a cleanup pass, a forward pass, leader pass,and placement pass to generate the output data stream. Further detailsof the encoding process are described herein.

As shown in FIG. 1, a compression system with the compression devicehaving the circuit may also include a network interface 104 fortransmitting the compressed output stream. The compression system withthe compression device having the circuit may also include a storagecontroller 108 for storing the compressed output stream on a physicalnon-transitory computer readable medium.

FIG. 4 illustrates a flowchart view of a method 400 for a parallelhistory search to compress data in accordance with an aspect ofembodiments described herein. The method 400 may be implemented by acircuit or particular hardware device, such as for example a GPU, aparallel CPU, FPGA or other parallel processing device. The method maybe implemented by a hardware compression device, or by a compressionsystem in various embodiments.

The method 400 may involve receiving an incoming input data stream, theinput data stream comprising a sequence of symbols. The method 400 mayinvolve storing on a memory device the sequence of symbols of the inputdata stream at storage locations. As will be described, the method 400involves parallel processing the input data stream in the memory deviceusing a parallel sort to generate a history search output data stream oftokens, each token defining a type, the type being either a literaltoken or a copy token. Each literal token defines a literal symbol ofthe sequence of symbols of the input data stream and each copy token hasa copy reference pointer identifying a position of one or more copiedsymbols in the sequence of symbols of the input data stream. Theposition corresponds to a storage location of the storage locations ofthe memory device storing the input data stream. The one or more copiedsymbols having corresponding one or more literal symbols of the literaltokens of the history search output data stream.

At step 402, a hardware compression device may, at each location, createtags to represent the input data stream. This tagging operation may beviewed as a k character or symbol sliding window, where k is an integer.For example, k may be four characters. That is, the hardware compressiondevice may continuously generate tags representing the input datastream, each tag defining a window of k consecutive symbols in thesequence of symbols, k being an integer, and a tag position in thesequence of symbols of the input data stream. The tag position may referto a first symbol of the k consecutive symbols in the window, the tagposition for a corresponding storage location of a first symbol of thewindow of k symbols in the memory device.

Compression may involve taking a hash of the character window andstoring the hash into a table for reference. The same four characterswill give the same entry into the table so that when the device detectsthe same hash in the table, the device performs a copy operation. Thisis generally a sequential process implemented using CPUs. However,parallel processing hardware may improve compression speed. The circuitmay use a comparator to compare the character window to other windows ofcharacters stored in the memory to find a match. Embodiments describedherein may implement a parallel history search using parallel processinghardware. A sequential history search may involve data dependencybecause earlier sequences of symbols are searched to find copyreferences. The embodiments described herein implement a parallelhistory search using tags and sorting operations.

For example, the tag operation may process the input data stream tocreates tags, where each tag stores a string of k symbols and thelocation. Referring to FIG. 2 as an illustrative example, if k=4, thenthe first tag would be (“nort” @ 0) and the second would be (“orth” @1).

At step 404, the compression device may sort the tags by prefixes,breaking ties with location. For letter symbols the sort may bealphabetical. Different sort orders may be defined for differentcharacters and symbols. The compression device will sort the tags toidentify redundant data in neighbouring or adjacent tags, and replaceredundant literal symbols or characters with copy reference pointers inorder to generate compressed output. For example, the sort may result in(“nort” @ 0), (“nort” @ 9), (“orth” @ 1), (“orth” @ 10), (“rth” @ 2),(“rthw” @ 11), and so on. For example, the compression device may sortthe tags based on the windows of k symbols. The compression device maycompare symbols from the storage locations in the memory device toidentify the one or more copied symbols and the corresponding one ormore literal symbols for the parallel sort and select, for each copyreference pointer, the storage location corresponding to the positionidentified by the respective copy reference pointer.

At step 406, the compression device may, for each tag in the sortedsequence, compare the tag with adjacent or neighbouring tags. Forexample, if there is a tag with a common prefix of at least four symbolsthat has an earlier source or other source, the system or device maycreate a copy token in the data stream. Otherwise, the system or devicemay create a literal token in the data stream. For example, in the datastream the symbols or characters of the tag (“nort” @ 9) may be replacedwith a copy token (copy @ 0) to indicate that four literal charactersshould be copied from location 0 for location 9. The notation (copy @ 0)is an illustrative example and may also be expressed as “copy 4 symbolsfrom 9 symbols ago”, “copy delta 9”, and so on. The symbols orcharacters of the tag (“orth” @ 10) may be replaced with the copy token(copy @ 1), “copy 4 symbols from 9 symbols ago”, “copy delta 9”, and soon. The process may transform the initial input data stream to generatean intermediate data stream of copy tokens and literal tokens, eachbeing linked to their original location in the input data stream.

The process may compare each tag to a predetermined number (e.g. threeforward and three backward but this can be modified and customized) ofneighbouring or adjacent tags to identify redundant tags, for eachredundant tag, the window of k symbols being equal to the window of ksymbols of another tag. The redundant tags may be identified using anumber of tokens smaller than the window. For example, k may be sevenand redundant tags may be identified by six overlapping symbols. Thenumber of common symbols used to identify redundant tags may be lessthan the number of symbols in the window. The process may involve, foreach redundant tag, generating a copy token of the copy tokens for thehistory search output data stream, and selecting the storage locationcorresponding to the tag position of the other tag for the copyreference pointer for the copy token for the redundant tag. Theredundant tags may be identified is a number of symbols are all equalanother tag. The process updates each redundant tag by replacing thewindow of k symbols of the redundant tag with the copy referencepointer.

At step 408, the system or device may order the resulting tokens bytheir original location in the input data stream (e.g. as stored in thetags) to generate a history search output data stream (e.g. anintermediate output stream). This may be an intermediate data structurethat may be provided as input to an encoder for further compressionprocessing. The process may involve ordering the tags, including theredundant tags, by the tag positions to generate the output data streamof the literal tokens and the copy tokens, the copy tokens correspondingto the redundant tags at the tag positions in output data stream.

For example, the input sequence “North by Northwest” shown in FIG. 2 maybe parallel processed by tagging and sorting to produce the(intermediate) history search output data stream:

Literal N

Literal o

Literal r

Literal t

Literal h

Literal SPACE

Literal b

Literal y

Literal SPACE

Copy 4 symbols from (delta) 9 symbols ago.

Copy 4 symbols from (delta) 9 symbols ago.

Literal r

Literal t

Literal h

Literal w

Literal e

Literal s

Literal t

The process may involve connecting to a recipient device to output thehistory search output stream for compression of the input data stream.

The process may involve encoding literal tokens and copy tokens of thehistory search output data stream into a compressed output stream byeliminating a portion of the copy tokens and a portion of the literaltokens, the compressed output data stream being compressed relative tothe input data stream. The process may coalesce copy tokens into largercopy tokens, coalesce individual literal tokens into larger literaltokens, and for copy tokens where length is n then the next n−1 tokensneed may be removed. This may be implemented by an encoder as describedherein.

Accordingly, after the history search process, the compression devicemay implement an encoding process to further compress the data resultingfrom the history search. For example, the final encoding may not includethe second copy, nor the literals for “rth”. The final encoding may alsocombine the two overlapping copies of length 4 to produce one of length5. But this is not the purpose of this history search stage of thecompression sequence. A separate encoding process may then encode theoutput of the history search into a stream that might look like thefollowing: (Literal length=9) “North by” (Copy delta=−9length=5)(Literal length=4) “west”. Special control codes may be used toencode (Literal length=9) and (Copy delta=−9 length=5), and so on. Thequotations would not be included and are used for clarity to define thestring of literals. An example encoding processing is described hereinin relation to FIG. 7. This is an illustrative example and otherencoding processes may be used to encode the results of the parallelhistory search in various embodiments.

FIG. 9 illustrates another example input stream. Referring back to thesearch history process 400 of FIG. 4, at 402, the compression devicecreates tags for the input data. The tags may be generated in parallel.For this example, each component of the tag has at least 4 characters.Longer sequences may make the sort operation slower, and shortersequences may create to many tags which may impact compression. Theexample tags may be (west @ 0) (este @ 1) (ster @ 2) and so on.

At 404, the compression device implements a parallel sort of the tagsusing prefix of characters or symbols (e.g. token) and the location.This will result in a sorted structure with all common prefixes beingadjacent entries in the data structure.

At 406, the compression device compares adjacent and neighbouringentries and matched common strings of symbols in parallel. For example,the compression device may look three entries ahead and three entriesbehind for common strings. The compression device replaces commonliteral strings with copy references. In some example embodiments, thecompression device uses a strict directed (e.g. only backward, onlyforward) reference to avoid circular pointers in the copy reference.

The compression device performs an encoding or tokenization for thehistory search and to replace literal tokens with copy tokens. At thestart of the encoded sequence the compression device may still generatemany literal tokens but as the memory size increase more copy tokenswill be generated to reference literal tokens.

For the example input string shown in FIG. 9, the intermediate datastream may be a combination of literal and copy tokens:WESTERN_NORTHWARD_BY[copy, 8][copy, 9][copy, 10]TH[copy, 0]EST, whereletter symbols indicate literal tokens.

The intermediate data stream output by the history search may also berepresented as: (Lit ‘W’)(Lit ‘E’)(Lit ‘S’)(Lit ‘T’)(Lit ‘E’)(Lit‘R’)(Lit ‘N’)(Lit ‘ ’)(Lit ‘N’)(Lit ‘O’)(Lit ‘R’)(Lit ‘T’)(Lit ‘H’)(Lit‘W’)(Lit ‘A’)(Lit ‘R’)(Lit ‘D’)(Lit ‘ ’)(Lit ‘B’)(Lit ‘Y’)(Copydelta=−13, len=4)(Copy delta=−13, length=4)(Copy delta=−13, len=4)(Copydelta=−13, len=4)(Lit ‘T’)(Lit ‘H’)(Copy delta=−26, length=4)(Lit‘E’)(Lit ‘S’)(Lit ‘T’). The reference “Copy delta” may indicate thelocation of the characters or symbols to copy relative to the locationof the copy token in the intermediate string. The reference “length” mayindicate the number of characters to copy.

The next stage in the compression is encoding which may further reducethe intermediate data structure to combine copies and remove redundantliterals.

The output of the encoder for the example WESTERN_NORTHWARD_BY_NORTHWESTmay be: (Literal length=20)“WESTERN_NORTHWARD_BY” (Copy delta=−13,length=5)(Copy delta=−26, length=4). Another example output of theencoder may be: (Literal length=20)“WESTERN_NORTHWARD_BY” (Copydelta=−13, length=6)(Literal length=3)“EST”. The first example maycompress better.

In accordance with another aspect, embodiments described herein mayprovide hardware implemented memory-based history search forcompression. To achieve high speeds in a compression algorithm, one ofthe steps to increase efficiency for compression speed is historysearch. The history data size may grow up to kilobytes, megabytes, oreven higher. Searching the history data for matches may be atime-consuming task during the compression process. An example hardwareplatform that may be used in order to parallelize the history search maybe an FPGA. Other example parallel processing devices may also be usedsuch as a GPU or parallel CPU, and may be ideal for this process.

Example embodiments described herein may be based on the requirements ofa fast and parallel history search for compression. Example embodimentsdescribed herein may use FPGAs as the compression device hardwareplatform. Example embodiments described herein may consider hardwareconstraints including: the number of available registers on the FPGA;route-ability; and power consumption.

Hardware Implementation

In some approaches, the serial nature of the input data and largehistories can result in a lengthy history matching/search process. Thespeed of this process may, in some examples, be improved byparallelization of one or more aspects of the process.

Hardware implementations of the history matching process may be suitablefor performing parallel tasks.

FIG. 5 illustrates aspects of an example circuit 500 for historymatching. The circuit 500 may be implemented with any combination ofdiscrete and/or integrated components. In some embodiments, the circuit500 can be implemented on a field-programmable gate array (FPGA) or anapplication-specific integrated circuit (ASIC).

The circuit 500 can be configured to history match input data 502 as asequence of words. In the example circuit 500 in FIG. 5, the words are32 Bytes long; however, in other embodiments, the words can be portionsof the data stream of any other length, for example, 1B, 2B, 4B, 8B,16B, 64B, 128B, 256B, etc. In some examples, the word length can bebased on hardware requirements or limitations (e.g. an FPGA data bussize limitation) or based on a history matching minimum tag size.

The circuit 500 can include a first memory 504 including a number ofstorage locations suitable for storing input data words. In someembodiments, the first memory can be made up of one or more storageelements. In other embodiments, the first memory can be a single largermemory element. For example, the first memory 504 in the example circuit500 of FIG. 5 includes sixteen 32B storage locations. In some examples,these storage locations could be spread across a number of registers orseparate memory devices. In another example, these storage locations canbe part of a single memory device such as a RAM (random access memory)module.

The first memory 504 having N storage locations can be configured tostore the N most recently introduced words from the sequence of inputdata. In some embodiments, the first memory 504 can be a shift memory orshift register. In some such embodiments, a newly introduced word can bestored in a first memory location (e.g. the memory location storing I15in FIG. 5) while all other words in the first memory being shifted tothe memory location to the right. With the introduction of a new word,the oldest word in the first memory 504 (i.e. the memory location storedI0 in FIG. 5) is overwritten or is otherwise flushed from the firstmemory. In other embodiments, the sequence of the shifting can be fromleft to right, or in any other first-in-first-out type order.

In another embodiment, the first memory 504 can be configured to storethe N most recently introduced words by overwriting the oldest word inthe first memory with a currently introduced word. For example, aselector such as a pointer, counter, linked list, or other element orprocess can provide an address or other storage location identifierwhich changes with the introduction of each word and cycles through eachmemory location. For example, the example circuit in FIG. 5 may includea 4-bit counter as a selector for the first memory.

In an illustrative example, a first word in the sequence can be storedat I15, a second word at I14, a third word at I13, etc., with thesixteen word being stored at I0. The seventeenth word would then bestored in I15 overwriting the first word in the sequence.

The first memory 504 can be an array of registers, circular buffers,etc. or any other data storage structure(s) which can allow a newlyintroduced word to be stored while allowing for all N storage locationsto be read in the same clock cycle. For embodiments where the words inthe first memory are shifted, the first memory 504 may be any datastorage structure(s) which can allow all N storage locations to be readand written in the same clock cycle.

In some embodiments, the first memory 504 may be an array of dual-portor two-port memory such that each storage location of the first memory504 can be both read and written to in the same clock cycle. In someexamples, this can allow for the memory to be writing a newly introducedword while being read to provide data 506 for comparison by thecomparators 508. In some instances, this may improve the effectivepipelining of the process.

The circuit 500 includes an array of second memories 510 for storinghistorical input data. The example circuit 500 in FIG. 5 includes anarray of sixty-four second memories each having 16 storage locations. Inother examples, any number M of second memories may be used. In someembodiments, the number of second memories may be based on hardwarerequirements, availability or limitations (e.g. an FPGA maximum blockRAM size) or based on a desired history matching size.

In some embodiments, the number of storage locations in each secondmemory corresponds to the number of storage locations in the firstmemory 504.

The array of second memories 510 defines a set of storage locations forstoring a history of the input data 502. In some embodiments, the set ofstorage locations can be logically divided into rows with each rowincluding one storage location from each of the second memories. Forexample, row 0 includes storage location I0 in Mem 0, storage location11 in Mem 1, storage location I2 in Mem 2, . . . and storage locationI63 in Mem 63.

In some embodiments, the second memories 510 can be configured to storethe N×M most recently introduced words. For example, a selector such asa pointer, counter, linked list or other element or process can providean address or other storage location identifier which changes with theintroduction of each word and cycles through each memory location. Forexample, in FIG. 5, a 10-bit counter can be used as a memory selectorwhere the lower 6 bits of the counter can identify in which of the 64second memories an introduced word is to be written, and the upper 4bits of the counter can identify the memory location within that secondmemory.

In some embodiments, the selector can cycle through memory locations inany sequence whereby M consecutively introduced words are each stored ina different second memory in the array.

In some embodiments, the second memories 510 may be a dual-port ortwo-port memories such that they can be both read and written to in thesame clock cycle. In some examples, this can allow for the memory to bewriting a newly introduced word while being read to provide data forcomparison by the comparators 508. In some instances, this may improvethe effective pipelining of the process.

In some embodiments, the circuit 500 can include a row selector foridentifying a select row of memory locations in the array of secondmemories which is to be compared with the words in the first memory. Forexample, a selector such as a pointer, counter, linked list or otherelement or process can provide an address or other row identifier whichchanges with the introduction of each word and cycles through each row.For example, in FIG. 5, a 4-bit counter can identify which of the 16rows is to be used in the current clock cycle and/or while the currentword is being introduced and stored in the memories.

In embodiments, where the circuit 500 is implemented on an FPGA, thespecifications of the FPGA may limit the options for the first and/orsecond memories. For example, not all the registers on an FPGA may beavailable as second memories to store history on the FPGA. For example,if the desired history size is 32 KB, configurations may specify that 32KB=256 Kb of registers are required to store the history on the FPGA.This amount of resources may not exist or may not be available to thehistory matching device. Even if the required number of registers areavailable to store the history on an FPGA, routing may become an issue.

In accordance with embodiments described herein, circuits and devicesmay store the history using on “on-chip memories” or BRAMs (Block-RAMs)as second memories. In some examples, this may simplify or help organizerouting and/or reduce the use or required number of registers.

The circuit 500 includes a plurality of comparators 508 for comparing aword from each storage location in the first memory 504 with the datastored in the select row of the second memories 510. In someembodiments, the comparators are configured to compare the word againsta series of data windows of the history data in the select row of thesecond memories. The number of data windows can, in some embodiments, bebased on the number of bits for encoding a symbol/character in thecompression process. In some embodiments, each data window can representa word-sized portion of the history data found at a different number ofsymbol-sized offsets. In other embodiments, data windows may be based onan input bus width or available resource(s) in the hardware.

In a basic example, a word in a first memory location of the firstmemory is one byte long and has a value of 0xFF. The second memory is anarray of three memories, and the storage locations in the select rowhave the values 0x11, 0x22, 0x33. If a symbol is four bits, the circuitwill have enough comparators to compare 0xFF with data windows of0x112233 shifted in 4-bit increments. In other words, comparators wouldbe configured to make at least five comparisons: 0xFF with 0x11, 0xFFwith 0x12, 0xFF with 0x22, 0xFF with 0x23, and 0xFF with 0x33.

The circuit would also have comparators to compare data in the othermemory locations of the first memory with the data from the select rowof the second memories. For example, if the next memory location of thefirst memory contains the value 0xEE, some of the comparators would beconfigured to compare: 0xEF with 0x11, 0xEF with 0x12, 0xEF with 0x22,0xEF with 0x23, and 0xEF with 0x33 (for the overlapping data windowbetween the two first memory locations); and 0xEE with 0x11, 0xEE with0x12, 0xEE with 0x22, 0xEE with 0x23, and 0xEE with 0x33.

The comparators would be configured to compare data windows from thedata in all of the first memory locations against data windows with allthe data in the select row of the second memories.

In some embodiments, the circuit may include storage elements forstoring data from previous data in the first memory and/or data from aprevious select row in order to capture any history matches which spanmultiple rows or multiple first memory words. In some embodiments, thestorage elements may be the size of a symbol/character.

For example, building on the example above, if the previous select rowended with 0x56 (i.e. the history data includes . . . 0x56112233 . . .), the circuit may have a storage element which stores the value 0x6. Inaddition to the above comparisons, the comparators would be configuredto compare 0x61 with the data of the first memories (0xFF, 0xFE, 0xEE,etc.). In some examples, this handling of data window(s) overlappingwith previous data rows could similarly be applied to the data window(s)for purged first memory data.

In some embodiments, the comparators are configured to concurrentlyperform all of the data comparisons for the data in the first memoryagainst the data in a select row.

The comparators may be any comparator circuit or device for determiningwhether two words have the same value. In some examples, the comparatorsmay be logic gates, FPGA logic blocks, lookup tables, or any othersuitable comparator circuit.

In some embodiments, the circuit 500 may include one or more storagedevices for storing the outputs of the comparators.

In some embodiments, the comparator outputs which represent historymatch results may be collated and/or provided to an encoder or otherdevice or process to continue the compression of the input data.

The illustrative example of FIG. 5 provides a history matching network,comparing 16 input against 32 KB of history stored in memory, in 16clock cycles.

As shown, assume blocks of n-byte input are streaming into the inputqueue to be compared against history. Also, assume that over time, thewhole 32 KBytes of history is stored into 64 memories, each of which is16 deep and 32 Bytes wide (64*16*32Bytes=32 KBytes). The history can bethought of as a sliding window that holds the past 32 KB of input data.

Assume for this illustrative example that each of the memories may beconfigured as dual-port. One port may be allocated for reading tocompare the content of history with the input. In order to compare ablock of 32 Byte input data with the whole history, 1024×32 Bytecomparisons may be required. This means that in clock cycle 0, location0 out of 15 may be read from all 64 memories for history compare and64×32 Byte comparisons are done. As the input is shifted into the16-deep input queue, it may be compared against the next 64 entries atlocation 1 of all the memories; then 64 entries at location 2 of all thememories and so on and so forth until the last comparison at location15. Then that input data block may be compared against the whole 32 KBof history.

Referring back to FIG. 5, in order to parallelize the history search formultiple blocks of input streaming in, the data read from the historymay be compared against the whole input queue. For example, input dataportion I0 may come in at Q=I0. Q15 may be compared with all-mems, loc0.Input data portion I1 may come in at Q=I1, I0. Q15, Q14 may be comparedwith all-mems, loc1, which may mean that I1 may not be compared againstfirst row of all-mems. Hence, reading from memories may be donecircularly to ensure each input block is compared against all mem rows.Then input data portion I2 comes in: Q=I2, I1, I0. Q15, Q14, Q13 may becompared with all-mems, loc2, and so on. Then input data portion I16 maycome in at I16, I15, I14, I13, . . . , I1. Q15, Q14, . . . , Q0 may becompared with all-mems, loc0. Additional details on processing may beshown in FIG. 6 which illustrates an example timing diagram of historysearch according to some embodiments.

The other memory port may be allocated to write the new input block intothe history. The new input may be written in location j out of 16 ofonly one memory. This location j may be calculated in a way that the newinput may be written either at the next empty location in history if itis not yet 32 KB, or, may overwrite the oldest entry in the history. Thewrite order may be found in the diagram shown in FIG. 6.

As an illustrative example, if the input is streaming into a 16-deepinput queue, then each input needs 16 clock cycles until it is comparedagainst the whole history. This may be performed in a pipeline format.The comparisons may overlap, which means it may only need 16 clockcycles to initialize the pipeline and after that, by reading the historyin a circular way, in each clock cycle the result of comparisons forfuture inputs may be ready.

This technique is explained herein using an illustrative example. Thisexample may be generalized for any number of input size and history sizewith consideration to the resource limitations of the FPGA or otherhardware used for the implementation.

Embodiments described herein may involve parallel hardware for GPUcontaining a hash table and forward copies. Hardware limitations may beconsidered when selecting the particular hardware for theimplementation. For example, it may be difficult to manage communicationand synchronization between compute units on GPU to create the output.

Embodiments described herein may involve a code implementation that isportable across different hardware platforms, and across differenthardware vendors (e.g. FPGA vendors). Embodiments described herein mayprovide heterogeneous implementation involving FPGA, CPU, andGPU/accelerated processing unit (APU) implementations.

In another aspect, embodiments described herein may provide an APUimplementation with a heterogeneous approach to combining parallelism ofGPU and CPU. Embodiments may involve parallel processing for an APUcomprising hash table creation (GPU), parallel literal and copy creation(GPU), and merging of output encoding (CPU). Hardware limitations may beconsidered when selecting the particular hardware implementation. Forexample, there may not be enough compute units on a GPU to implement theprocessing.

In a further aspect, embodiments described herein may provide anotherAPU implementation with a heterogeneous approach to combiningparallelism of GPU and CPU. Embodiments may involve parallel processingfor an APU comprising global hash table creation (GPU), parallel literaland copy creation (GPU), and merging of output encoding (CPU). Hardwarelimitations may be considered when selecting the particular hardwareimplementation. For example, a global memory may involve execution ofthe kernel.

Encoder

In another aspect, embodiments described herein may provide a systolicdictionary-based compression encoder, e.g. a hardware device configuredto implement encoding to transform a sequence of tokens into acompressed output stream. An example application may be on-the-flynetwork compression. After implementing a history search, thecompression device may encode the data stream for further compression.This may involve combining copies of copy tokens and removing furtherredundant literal tokens. The pre-processed intermediate data streamthat provides input for the encoder may result from the parallel historysearch described herein, or another search process. Other examplehistory searches include traditional “snappy” processes using hashtables, the FPGA hardware implementation described herein, and so on. Asan illustrative example for different history search processes considerthe input data stream “BRANDISH_OATBRAN_BRANDY”. At the position of“BRANDY”, a history search could find “BRAND” from “BRANDISH” or “BRAN”from “OATBRAN”. Either may be correct output from a history search.Different searches may prioritize one over the other. This output of thehistory search is provided to an encoder for further processing.

An encoder may generally look for adjacent copy tokens where the firstlength of symbols or delta for the copy reference (e.g. copy foursymbols from 9 symbols ago) is greater than or equal to the next delta.The encoder may select the first copy token and then look at adjacentcopy tokens. The encoder may start incrementally deleting copy tokensand expanding the number of characters copied in the first copy token.

As shown in FIG. 2, the intermediate data stream may be a combination ofliteral and copy tokens: NORTH_BY_[copy, 0][copy, 1]RTHWEST. Theresulting output from the encoder is shown in FIG. 2 which combines thetwo copy tokens [copy, 0] for “nort” and [copy, 1] for “orth” each withfour symbols into one copy token of five symbols for “north”.

As shown in FIG. 9, the intermediate data stream may be a combination ofliteral and copy tokens: WESTERN_NORTHWARD_BY[copy, 8][copy, 9][copy,10]TH[copy, 0]EST. A copy token reference may initially reference fourcharacters but after encoding may reference six characters and removetwo copy tokens. In this example, the encoder may combine the initiallyseparate copy tokens “nort” “orth” “rthw” into one copy token “northw”with a larger set of symbols or characters.

As shown by these examples, this encoding process expands the number ofsymbols in a copy token while removing adjacent copy tokens to providefurther compression.

For this example, a task of the encoder may include merging adjacentliterals into larger literals. The history search may indicate thatthere is (Lit ‘N’)(Lit ‘O’)(Lit ‘R’)(Lit ‘T’)(Lit ‘H’) and turn it into(Lit length=5) “North”. Another task of the encoder may include mergingadjacent copies to overlapping sources. For example, (Copy delta=−4len=4)(Copy delta=−4 len=4) can be changed into (Copy delta=−4 len=5)and the subsequent copy removed from the stream. A further task of theencoder may include removing literals that are “covered” by copies. Theoutput from the history stream for the stream “AAAAAA” may be (Lit‘A’)(Copy delta=−1 length=4)(Copy delta=−1 length=4)(Lit ‘A’)(Lit‘A’)(Lit ‘A’) and the encoder may transform it into (Litlength=1)′A′(Copy delta=−1 length=5). Notice that the tailing literalshave been “covered” by the copy.

The encoder may implement a greedy algorithm process that may attempt toget the longest copy reference length when deleting adjacent copyreferences. This may not always provide the optimal compression but thismay result in increased compression speed. For example, some encodingoperations may select optimal combinations of repeated words. Referringto the example in FIG. 9, instead of making longer copy token “northw”another process may look to remove as many repetitions as possible andidentify “north” and “west”, for example.

The encoding processing may also decrease the window size to createadditional copy tokens to remove redundant literals. For, example theliteral token “est” may be replaced with a copy token by reducing windowsize.

The encoder may be implemented using parallel processing for the scanoperation (which may also referred to as a prefix sum). The scan isparallel and used for compression processes according to someembodiments described herein. For example, the encoder may implement thescan process on intermediate data produced by the parallel historysearch described herein, or by other history search techniques in otherembodiments.

As noted, compression may take a sequence of symbols as input, andattempt to produce a shorter sequence as output. Dictionary basedcompression schemes may find repeated substrings in the input and encodesubsequent occurrences as copy reference pointers to earlieroccurrences, or later occurrences, for example.

Embodiments described herein may provide a mechanism to transform asequence of symbols into a sequence of tokens. Each symbol may be eithera literal token (e.g. not a reference to a previous/later position inthe input stream), or a copy token from the history specifying theposition in the stream and the number of characters copied. Copy tokensmay have copy different numbers of characters, as the encoder willcombine copy tokens from the history search output to provide compressedoutput data.

Embodiments described herein may use a data-parallel encoding mechanism.The input data stream may be encoded sequentially which may make theencoding process the bottleneck. In some examples where the historysearch is also parallel then a sequential encoding processing may losethe processing benefits of parallelizing the history search.Accordingly, embodiments described herein may involve a mechanism forperforming the encoding process in parallel.

Embodiments described herein may provide a circuit for an encodingdevice 806 (FIG. 8) to encode an input data stream to generate acompressed output stream.

The circuit may have an input unit to receive an incoming input datastream of a sequence of tokens. Each token defines a position in theinput data stream, a length and a type. The type may be a literal tokenor a copy token. Each literal token defines a literal symbol and eachcopy token has an offset to the position of another token in thesequence of tokens in the input data stream. A memory device stores thesequence of tokens of the input data stream at storage locations.

A parallel processor encodes the tokens using a parallel scan of theinput data stream in the memory device to simultaneously process eachtoken of the input data stream while referencing other tokens thatprecede the position of the respective token in the sequence of tokensof the input data stream. The parallel processor generates thecompressed output stream by eliminating a portion of the tokens of theinput data stream based on the results of the parallel scan.

A plurality of comparators to compare the sequence of tokens from thestorage locations in the memory for the parallel scan. Examples ofcomparators are described herein in relation to the FPGA memory search.A memory selector to select, for each copy token, the storage locationcorresponding to the position of the offset. Examples of comparators andselectors are described herein in relation to the FPGA memory search.The comparators and selectors may be used to implement operations of theparallel scan.

An output unit configured to connect to a recipient device to output thecompressed output stream. A compression device may receive the output ofthe circuit of claim for provision to a network interface fortransmitting the compressed output stream. A compression system mayreceive the output of the circuit for provision to a storage controllerfor storing the compressed output stream on a physical non-transitorycomputer readable medium. The circuit may be implemented on graphicprocessing unit, a parallel central processing unit or a fieldprogrammable gate array. The parallel processor may implement a parallelhistory search to generate the tokens of the input data stream. Theparallel processor may implement a parallel history search using aparallel sort to generate the tokens of the input data stream. Theparallel processor may implement sequential history search to generatethe tokens of the input data stream. Accordingly the parallel processorfor encoding can work with different types of history searches toreceive the input tokens.

The encoding process may be implemented in the case where there are asmany threads as input tokens. i.e., each thread will be responsible foremitting bytes generated by its own token. This may be challengingbecause the position each thread would need to write is dependent on theaggregate of the number of bytes written by all threads that precede itin the input stream. Some communication may be required between threads,but may be kept to a minimum to efficiently use communication resources.

As an illustrative example overview, systems, methods and devices inaccordance with embodiments described herein may use a scan techniquefor parallel processing.

The parallel scan technique may be a generalization of a prefix sum, forexample. The technique may involve using an associative operator ⊕, anda sequence e x_(i) with iε{1, 2, . . . , n} and calculates:

$y_{j} = {\underset{i = 1}{\overset{n}{\oplus}}x_{i}}$

For example, the sequence 1; 2; 3; 4; 5 with the operator being additionmay generate: 1; 3; 6; 10; 15. That is, the jth term is a sum (using theprovided operator) of the first j terms of the input sequence.

A variation, called a right scan, or forward scan, instead sums from theend of the sequence. To distinguish, the standard technique may bereferred to as a left scan or backward scan. This technique may beperformed in parallel. For a sequence of length n with m independentprocessors, the technique may be calculated in

${\log_{2}(n)}\frac{n}{m}$stages.

The parallel scan technique may work as follows: the input data may bedefined in log₂ (n) stages. At each stage j, the technique may computeyj;i for i in 0; 1, 2, . . . , n−1. The following definition may be usedy₀, i=x_(i) for iε{1, 2, . . . , n}. For stage k E {1, 2, . . . , [log₂(n)]}, the following definition may also be used Δ=2^(k-1). For aforward pass, the following definition may be usedY_(k,i)=y_(k-1,i-Δ)⊕y_(k-1,i). For a backward pass, the followingdefinition may be used y_(k,i)=y_(k-1,i+Δ)⊕y_(k-1,i).

In another aspect, embodiments described herein provide a process forcompression encoding using a parallel process. FIG. 7 illustrates anexample method 700 for data compression according to some embodiments.The method 700 may be implemented by a circuit, encoder, a compressiondevice, compression system, and so on.

In some example embodiments, the encoding process may encode the outputof the parallel history search as described in relation to FIG. 4. Asnoted, the separate encoding process of FIG. 7 may then encode theoutput of the history search for the example input stream of FIG. 2 togenerate the following output stream: (Literal length=9) “North by”(Copy delta=−9 length=5)(Literal length=4) “west”. There may be specialcontrol codes may be used to encode (Literal length=9) and (Copydelta=−9 length=5), and so on. The quotations would not be included andused for clarity.

Each token may have a length, len(τ), and a type, type(τ) which iseither a literal value or a copy reference pointer. Copy tokens may alsodefine an offset, offset(τ) which may be the number of characters backthe copy is from. Literal tokens may define a symbol sym(τ).Accordingly, the input data stream may be a sequence of tokens, whereeach token defines a position in the input data stream, a length and atype, the type being a literal token or a copy token. Each literal tokenmay define a literal symbol, and each copy token may have an offset tothe position of another token in the sequence of tokens in the inputdata stream.

The process involves encoding the tokens using a parallel scan of theinput data stream in a memory device to simultaneously process eachtoken of the input data stream while referencing other tokens thatprecede the position of the respective token in the sequence of tokensof the input data stream. The process involves generating a compressedoutput stream by eliminating a portion of the tokens of the input datastream based on the results of the parallel scan. The output of theparallel scan may be updated tokens (e.g. updated copy tokens andliteral tokens) along with a data structure identifying leader tokens,non-leader tokens, size data for the tokens, and position data for thetokens to instruct generation of the compressed output stream. Thegeneration of the compressed output stream involves writing tokens tothe positions, where the leader tokens, non-leader tokens and size dataindicates which tokens are written out. For example, all leaders tokensmay be written out but size zero copy tokens may not be written out. Theprocess involves making available the encoded compressed output data asnon-transitory computer readable medium or shared memory ortransmission.

The process involves encoding the tokens using the parallel scan with abackward pass, a cleanup pass, a forward pass to simultaneously processthe tokens of the input data stream to update the input data stream forgenerating the compressed output stream.

At step 702, the compression device may implement a backward pass.

In the first pass, both literals and copies may be present. Literaltokens may have length 1, copy tokens may have larger lengths. Theexamples herein provide an intermediate data stream with copy tokensinitially of four characters. For this operation, the candidate tokenmay be defined as y and the pivot be π. The distance between the twotokens is delta Δ. When the condition is not met, the output may beidentical to the pivot.

type(γ) type (π) condition new token COPY — len(γ) > Δ COPY(offset(γ),len(γ) − Δ)

At step 704, the compression device may implement a cleanup pass. Forexample, the system or device may implement two passes of a backwardscan technique with the following:

type(γ) type(π) condition new token COPY COPY offset(γ) ≠ offset(π) LITΔ − len(γ) + len(π) < 4

At step 706, the compression device may implement a forward pass. In thethird pass, any token covered by a copy may also be a copy. The leaderof a sequence of copies with the same offset may have a length of atleast 4. The purpose of this pass may be to polymerize or coalesceoverlapping copies that have the same offset, as well as coalescingback-to-back literals to generate a longer sequence of literals. Thismay be a forward scan since the technique may propagate information fromlater entries in the stream to earlier entries.

The operator may be:

type(π) type(candidate) condition new token LIT LIT len(π) ≧ ΔLIT(sym(π), Δ + len(γ)) COPY COPY offset(γ) = offset(π) COPY(offset(π),len(π) ≧ Δ max(len(π), Δ + len(γ)))

The process may involve using a leader pass and a placement pass toidentify non-leader tokens, leader tokens, sizes for the tokens, andpositions for the tokens in the compressed output stream to eliminatethe portion of the tokens of the input data stream when generating thecompressed output stream.

At step 708, the compression device may implement a leader pass. Theinitial token may be a leader. A literal immediately followed orpreceded by a copy may be a leader. A copy followed or preceded by aliteral may be a leader. A copy followed or preceded by a copy with adifferent offset may be a leader. No other tokens may be leaders, forthis illustrative example. This may be implemented by looking at a tokenand its predecessor independently of all other leader checks.

At step 710, the device or system may implement a placement pass. As anillustrative example, assume there is a function a mapping each token toan encoding size in constant time. In some examples, all non-leadercopies may be fixed with a size of 0 and all non-leader literals to havea size of 1, then a prefix sum of the sizes will provide the endpoint ofeach token after it is encoded. Subtracting the size from this positionyields the start location. Each token can be encoded independently. Theprefix sum may be a backward pass.

The final pass may clean up conflicting copies for leader selection. Theforward pass may coalesce copies into larger copies and literals intoliteral chains. The cleanup pass may remove certain short copies thatare shorter than 4 symbols long and may result in being encoded in morebytes than a literal would occupy. The placement pass may be theencoder. Each pass may be data parallel and may lend itself well toparallel architecture.

FIGS. 10 and 11 shown an example of the encoding process of FIG. 7 atdifferent stages. FIG. 10 relates to the input data stream‘aaaaabaaaaaa’. FIG. 11 relates to the input data stream ‘North byNorthwest’. The input data streams are shown as tokens, includingliteral tokens and copy tokens. The literal tokens have a literal symboland length shown by the format ‘literal symbol’:length. The copy tokenshave a copy reference pointer with an offset value and a length ofsymbols to copy as shown by the format Copy (offset,length). Thedifferent columns show example results of the scan passes or stages.

The parallel processor uses the parallel scan with a backward pass, acleanup pass, a forward pass to simultaneously process the tokens of theinput data stream to update the input data stream for generating thecompressed output stream. BW refers to backward passes, CLEAN refers tocleanup passes, and FW refers to forward passes. Each pass isimplemented as a parallel scan with different scan parameters. Thepasses update the tokens of the input data stream.

The column entitled “BW-1” refers to a backward pass looking at oneposition over, “BW-2” refers to a backward pass looking at two positionsover, and so on. The table highlights edge cases to highlight operationsof the stages or passes. In the first example shown in FIG. 10, thehighlighting shows the purpose of the cleanup pass. There are extra copytokens at the end of the backward pass that would result in copies thatare shorter than length four.

In the forward pass for the “north by northwest” example input datastream of FIG. 11 for literals the encoder uses a length to representhow many literals “follow” the current literal. The encoder uses thepredefined length in order to know the size as well as what to put intothe header. The token for N:9 may highlight an example where you needall log(N) stages of the forward pass to get the final encoding. Thecopy tokens are interesting in “north by northwest” example input datastream of FIG. 11 because the encoding process takes a few stages tostabilize, but the encoder does stabilize in the end.

The parallel processor uses a leader pass and a placement pass toeliminate the portion of the tokens of the input data stream whengenerating the compressed output stream. The column “Leaders” showsexample results of the leader pass. The column “sizes” and “position”shown example results of the placement pass, which generates the sizeand position data.

The parallel processor updates the incoming input data stream using abackward pass (referenced as BW) to replace literal tokens withadditional copy tokens, the replaced literal tokens being tailing endsof leader copy tokens. The additional copy tokens are eliminated fromthe compressed output data stream and the replaced literal tokens arecovered by the leader copy tokens.

The parallel processor updates the incoming input data stream using acleanup pass (referenced as CLEAN) to replace copy tokens having alength of that is less than four with literal tokens. The parallelprocessor updates the incoming input data stream using a forward pass tocoalesce consecutive overlapping copy tokens that have the same offsetand contiguous literal symbols.

The parallel processor uses a leader pass to flag each token as beingeither a non-leader token or a leader token, the leader token being atleast one of an initial token in the input data stream, a literal tokenfollowed or preceded by a copy token in the input data stream, a copytoken followed or preceded by a literal token in the input data stream,and a copy token followed or preceded by a copy token with a differentoffset in the input data stream.

The parallel processor uses a placement pass to generate sizes for thetokens by fixing all non-leader tokens to have size zero and all leadertokens to have a size of one and determine, and positions for the tokensin the compressed output data stream, each position defined by anendpoint and a start point for the token, the endpoint being a prefixsum of the sizes of all preceding tokens, the start point being adifference between the position and the prefix sum.

The parallel processor generates the compressed output data stream usingresults of the placement pass by writing out all tokens having anon-zero size using the sizes for the tokens to the positions for thetokens in the compressed output data stream. The results for the leadertokens (and non-leader tokens), the sizes and positions are used togenerate or write the tokens for the compressed output data stream. Theleader tokens and non-leader tokens may be used to generate the sizedata. All tokens are size zero are not written out to the compressedoutput data stream, which results in compression of the initial inputdata stream of tokens. The placement indicates the position of where atoken should be written out in the compressed output data stream.

The parallel processor eliminates the portion of the tokens of the inputdata stream by coalescing copy tokens into larger copy tokens,coalescing individual literal tokens into larger literal token, and, forcopy tokens where length is n, eliminating the next n−1 tokens in theinput data stream.

The processor eliminates the portion of the copy tokens by increasing anumber of symbols to be copied by a copy token adjacent to theeliminated portion of the copy tokens.

The encoder eliminates the portion of the copy tokens by replacing eachcopy token having a length less than a predefined threshold with aliteral token.

Accordingly, embodiments described herein may provide systems, devicesand methods for parallelizing a sequential process. Intuitively, theposition of each encoding may depend on the aggregate encoding of allprevious tokens. Embodiments described herein may provide systems,devices and methods for encoding tokens in the input stream in parallel.

The passes may be referenced as stages of the parallel scan. The scan(forward, backward, cleanup) takes tokens as input and outputs a groupof tokens with different values. The leader pass identifies which tokensneed a header in the final output. A header of a token may indicate aleader or non-leader (by comparing each token to previous token). Theplacement pass determines what tokens may be eliminated. For example,leader tokens provide information to size the tokens, and the prefix sumindicates position information for writing tokens at the locations orpositions output by the prefix sum. The sizing indicates that sometokens take up zero bytes and these would be eliminated from thecompressed output data stream. The leader pass and placement pass toeliminate a portion of the copy tokens of the sequence tokens of theinput data stream, the encoding of, the compressed output data streambeing compressed relative to the input data stream. The parallel scanuses different passes by repeated calls using slightly differentparameters to generate the data used to write the compressed output datastream.

The encoder coalesces the portion of the copy tokens by increasing anumber of symbols to be copied by a copy token adjacent to theeliminated portion of the copy tokens. The encoder coalesces consecutiveoverlapping copies into longer copies.

In another aspect, embodiments described herein may provide acompression engine device implementing data transformation techniquesdescribed herein. FIG. 8 shows an illustrative example compressionengine device 800 (referred to generally as compression device)transforming uncompressed input data 802 into compressed output data810. The example compression engine device may include a searchprocessor 804 (e.g. implementing dictionary-based history search), anencoder 806 and an output generator 808.

The compression engine device 800 may be implemented using an integratedhardware device in some examples, or by distributed devices with director network connections.

The compression engine device 800 may implement parallel data processingusing vector machines, as an illustrative example. At stage 1, thecompression device 800 may use the processor 804 for a history scanbased on sorting and merging using parallel data processing techniques.At stage 2, the compression device 800 may use the encoder 806. As anexample, the compression engine device may use one logical processor foreach byte of input. For this illustrative example, the compressiondevice 800 may perform O(log n) passes where n is the size of the input.Each processor may use a constant size input per pass. The systoliccommunication and synchronization may be an efficient use of thehardware resources.

Embodiments described herein may use a parallel data processingtechnique as described herein. The encoding may translate efficiently toFPGA, for example. The input may be partitioned into chunks fordifferent granularity streaming. The finer-grained streaming may impactthe compression ratio. The history scan implementation may requirehardware considerations. Sorting may be implemented using CPU/GPUarchitectures. FPGA architectures and line rat may require a largenumber of multiplexers and priority encoders. This may be resourceintensive.

Modified embodiments may use bloom filters, linear scan, and so on.Modified embodiments may consider history size as a parameter that maybe increased with bigger FPGAs. For some examples, the history size maybe limited depending on the size of the FPGA. Other parameters mayinclude input chunk size, and so on. Embodiments described herein mayinclude propagation of copies or literals across windows to removelimitation of fine-grained streaming. Embodiments described herein mayprovide an efficient hardware architecture with no or few pipelinebubbles. Embodiments described herein may account for data streaming.Embodiments described herein may provide an interface for the hardwareimplementation. Embodiments described herein may include reconfigurablecomponents. Embodiments described herein may implement in-pathcompression for solid state drives, hard disk drives, memory, network,and so on. Embodiments described herein may implement bit streamcompression to speed up FPGA partial reconfiguration. Embodimentsdescribed herein may implement high speed decompression.

Embodiments may provide a technical solution embodied in the form of asoftware product. The software product may be stored in a non-volatileor non-transitory storage medium, which can be a compact disk read-onlymemory (CD-ROM), USB flash disk, or a removable hard disk. The softwareproduct may include a number of instructions designed to enable acomputer device (personal computer, server, or network device) toexecute the methods provided in the embodiments.

Program code is applied to input data to perform the functions describedherein and to generate output information. The output information isapplied to one or more output devices. In some embodiments, thecommunication interface may be a network communication interface. Inembodiments in which elements of the invention are combined, thecommunication interface may be a software communication interface, suchas those for inter-process communication. In still other embodiments,there may be a combination of communication interfaces implemented ashardware, software, and combination thereof.

Each computer program may be stored on a storage media or a device(e.g., ROM, magnetic disk, optical disc), readable by a general orspecial purpose programmable computer, for configuring and operating thecomputer when the storage media or device is read by the computer toperform the procedures described herein. Embodiments of the system mayalso be considered to be implemented as a non-transitorycomputer-readable storage medium, configured with a computer program,where the storage medium so configured causes a computer to operate in aspecific and predefined manner to perform the functions describedherein.

Furthermore, the systems and methods of the described embodiments arecapable of being distributed in a computer program product including aphysical, non-transitory computer readable medium that bears computerusable instructions for one or more processors. The medium may beprovided in various forms, including one or more diskettes, compactdisks, tapes, chips, magnetic and electronic storage media, volatilememory, non-volatile memory and the like. Non-transitorycomputer-readable media may include all computer-readable media, withthe exception being a transitory, propagating signal. The termnon-transitory is not intended to exclude computer readable media suchas primary memory, volatile memory, RAM and so on, where the data storedthereon may only be temporarily stored. The computer useableinstructions may also be in various forms, including compiled andnon-compiled code.

Numerous references will be made regarding servers, services,interfaces, portals, platforms, or other systems formed from hardwaredevices. It should be appreciated that the use of such terms is deemedto represent one or more devices having at least one processorconfigured to execute software instructions stored on a computerreadable tangible, non-transitory medium. One should further appreciatethe disclosed computer-based algorithms, processes, methods, or othertypes of instruction sets can be embodied as a computer program productcomprising a non-transitory, tangible computer readable media storingthe instructions that cause a processor to execute the disclosed steps.

Various example embodiments are described herein. Although eachembodiment represents a single combination of inventive elements, allpossible combinations of the disclosed elements are considered to theinventive subject matter. Thus if one embodiment comprises elements A,B, and C, and a second embodiment comprises elements B and D, then theinventive subject matter is also considered to include other remainingcombinations of A, B, C, or D, even if not explicitly disclosed.

As used herein, and unless the context dictates otherwise, the term“coupled to” is intended to include both direct coupling (in which twoelements that are coupled to each other contact each other) and indirectcoupling (in which at least one additional element is located betweenthe two elements). Therefore, the terms “coupled to” and “coupled with”are used synonymously.

The embodiments described herein are implemented by physical computerhardware embodiments. The embodiments described herein provide usefulphysical machines and particularly configured computer hardwarearrangements of computing devices, servers, electronic gaming terminals,processors, memory, networks, for example. The embodiments describedherein, for example, are directed to computer apparatuses, and methodsimplemented by computers through the processing and transformation ofelectronic data signals.

The embodiments described herein may involve computing devices, servers,receivers, transmitters, processors, memory, display, networksparticularly configured to implement various acts. The embodimentsdescribed herein are directed to electronic machines adapted forprocessing and transforming electromagnetic signals which representvarious types of information. The embodiments described hereinpervasively and integrally relate to machines, and their uses; and theembodiments described herein have no meaning or practical applicabilityoutside their use with computer hardware, machines, a various hardwarecomponents.

Although the present invention and its advantages have been described indetail, it should be understood that various changes, substitutions andalterations can be made herein without departing from the invention asdefined by the appended claims.

Moreover, the scope of the present application is not intended to belimited to the particular embodiments of the process, machine,manufacture, composition of matter, means, methods and steps describedin the specification. As one of ordinary skill in the art will readilyappreciate from the disclosure of the present invention, processes,machines, manufacture, compositions of matter, means, methods, or steps,presently existing or later to be developed, that perform substantiallythe same function or achieve substantially the same result as thecorresponding embodiments described herein may be utilized according tothe present invention. Accordingly, the appended claims are intended toinclude within their scope such processes, machines, manufacture,compositions of matter, means, methods, or steps.

What is claimed is:
 1. A circuit for history matching a data streambeing sequentially introduced to the circuit, the circuit comprising: afirst memory including N storage locations, the first memory configuredto store a currently introduced sequence of symbols such that the N mostrecently introduced words are stored in the first memory; an array of Msecond memories, each second memory including N storage locations, thearray defining a set of storage locations logically divided into N rowsof M storage locations, each row including one storage location fromeach of the M second memories, the array of M second memories configuredto store the currently introduced word at a select storage location ofthe set of storage locations; a plurality of comparators configured forcomparing data from all of the storage locations in the first memorywith data stored in a select row of the set of storage locations, whereoutputs of the comparators provide history matching data; a memoryselector for identifying the select storage location, the memoryselector configured to identify a next storage location in a storagelocation sequence with the introduction of each word, where the storagelocation sequence cycles through the set of storage locations such thatM consecutively introduced words are each stored in a different secondmemory in the array; and a row selector for identifying the select row,the row selector configured to identify a next select row with theintroduction of each word, the select row cycling through each of the Nrows for every N introduced words.
 2. The circuit of claim 1 wherein theplurality of comparators are configured to compare overlapping datawindows of the data in the first memory and the data in the select row.3. The circuit of claim 1 wherein each of the second memories are dualport memories or two port memories.
 4. The circuit of claim 1 whereinthe circuit is implemented on a field-programmable gate array (FPGA) oran application specific integrated circuit (ASIC).
 5. The circuit ofclaim 4 wherein the second memories are block random access memories. 6.The circuit of claim 1 comprising a storage device for storing theoutputs of the comparators.
 7. The circuit of claim 1 wherein the firstmemory is a shift register or a circular buffer.
 8. The circuit of claim1 wherein the circuit is a synchronous circuit configured to introduce anew word every clock cycle.
 9. The circuit of claim 8 wherein anintroduced word is compared against an N×M word history after N clockcycles.
 10. The circuit of claim 2 wherein the data windows are based onan input bus width or circuit resource availability.
 11. A method forhistory matching a data stream, the method comprising: sequentiallyintroducing each word in the data stream, where introducing a currentword in the input sequence includes: storing the current word in astorage location of a first memory having N storage locations such thatthe N most recently introduced words are stored in the first memory;storing the current word in an array of M second memories, each secondmemory including N word storage locations, the array defining a set ofstorage locations logically divided into N rows of M storage locations,each row including one storage location from each of the M secondmemories, wherein the current word is stored according to a storagelocation sequence which cycles through the set of storage locations suchthat M consecutively introduced words are each stored in a differentsecond memory in the array; concurrently comparing data stored in the Nstorage locations of the first memory with data stored in a select rowof the set of storage locations; and storing outputs of the comparisonsas history match results; wherein the select row changes with theintroduction of each word, the select row cycling through each of the Nrows for every N introduced words.
 12. The method of claim 11 whereincomparing the data stored in the N storage locations of the first memorywith the data stored in the select row comprises comparing overlappingdata windows of the data in the N storage locations of the first memoryand the data stored in the select row.
 13. The method of claim 11wherein each of the second memories are dual port memories or two portmemories.
 14. The method of claim 11 wherein the method is performed ona field-programmable gate array (FPGA) or an application specificintegrated circuit (ASIC).
 15. The method of claim 14 wherein the secondmemories are block random access memories.
 16. The method of claim 11wherein storing the outputs of the comparisons comprises collating thehistory match results.
 17. The method of claim 11 comprising providingthe history match results to an encoder.
 18. The method of claim 11wherein an introduced word is compared against an N×M word history afterN clock cycles.
 19. The method of claim 12 wherein the data windows arebased on an input bus width or circuit resource availability.
 20. Adevice for history matching a data stream, each word of the data streambeing sequentially introduced, the device comprising: a first memoryincluding N storage locations, the first memory configured to store acurrently introduced word such that the N most recently introduced wordsare stored in the first memory; an array of M second memories, eachsecond memory including N storage locations, the array defining a set ofstorage locations logically divided into N rows of M storage locations,each row including one storage location from each of the M secondmemories, the array of M second memories configured to store thecurrently introduced word at a select storage location of the set ofstorage locations; a plurality of comparators configured for comparingdata from all of the storage locations in the first memory with datastored in a select row of the set of storage locations, where outputs ofthe comparators provide history matching data; a memory selector foridentifying the select storage location, the memory selector configuredto identify a next storage location in a storage location sequence withthe introduction of each word, where the storage location sequencecycles through the set of storage locations such that M consecutivelyintroduced words are each stored in a different second memory in thearray; and a row selector for identifying the select row, the rowselector configured to identify a next select row with the introductionof each word, the select row cycling through each of the N rows forevery N introduced words.